package info.nixbear.tgcms.admin.client.view;

import info.nixbear.tgcms.admin.client.activity.TemplateEditActivity;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;

public class TemplateEditView extends Composite {

	private static TemplateEditViewUiBinder uiBinder = GWT
			.create(TemplateEditViewUiBinder.class);

	interface TemplateEditViewUiBinder extends
			UiBinder<Widget, TemplateEditView> {
	}

	public TemplateEditView() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	TemplateEditActivity templateEditActivity;

	@UiField TemplateEditor editor;
	@UiField Button save;
	@UiField Button cancel;


	@UiHandler(value={"cancel","back"})
	void onCancel(ClickEvent event) {
		this.templateEditActivity.onCancel(event);
	}
	
	@UiHandler("save")
	void onSave(ClickEvent event) {
		this.templateEditActivity.onSave(event);
	}

	public TemplateEditor getEditor() {
		return editor;
	}

	public TemplateEditActivity getTemplateEditActivity() {
		return templateEditActivity;
	}

	public void setTemplateEditActivity(TemplateEditActivity templateEditActivity) {
		this.templateEditActivity = templateEditActivity;
	}

	
}
